package com.zbkj.crmeb.order.request;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.List;

@Data
@Accessors(chain = true)
public class CarottaOrderRequest implements Serializable {

    @JSONField(name ="line_items")
    private List<Item> lineItems;

    @JSONField(name ="email")
    private String email;

    @JSONField(name ="inventory_behaviour")
    private String inventoryBehaviour;

    @JSONField(name ="shipping_address")
    private Address shippingAddress;

    @JSONField(name ="billing_address")
    private Address billingAddress;

    @JSONField(name ="customer")
    private Customer customer;

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Address {

        @JSONField(name ="first_name")
        private String firstName;

        @JSONField(name ="last_name")
        private String lastName;

        @JSONField(name ="address1")
        private String address1;

        @JSONField(name ="city")
        private String city;

        @JSONField(name ="country")
        private String country;

        @JSONField(name ="province")
        private String province;

        @JSONField(name ="zip")
        private String zip;

        @JSONField(name ="phone")
        private String phone;
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Item {

        @JSONField(name ="variant_id")
        private Long variantId;

        @JSONField(name ="quantity")
        private Integer quantity;
    }

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Customer {

        @JSONField(name ="firstName")
        private String first_name;

        @JSONField(name ="lastName")
        private String last_name;

        @JSONField(name ="email")
        private String email;
    }

}
